<!DOCTYPE html>
<html>
 {{{ html.header(out) }}}
<body>

{{{ html.navbar(out,"/web/main") }}}
  
<div class="container">

  <div class="row-gy-5">
     <div class="col">
        {{{ 
          out("Started %s</br>",os.date("%c",EM._info.started))
          out("Running for %ss</br>",EM.osTime()-EM._info.started)
          out("HC3 at %s</br>",EM.IPAddress)
        }}}
     </div>
  </div>
  
  <hr>

  <div class="row row-gy-5">
  
    <div class="col-sm-6">
    
       <div class="row"><h4>Loaded QuickApps</h4></div>
       
        {{{
          for id,D in pairs(EM.Devices) do
            if D.dev.parentId == 0 then
               local qa = D.env.quickApp
               if qa then
                 out('<div class="row row-cols-3">')
                 out('<div class="col-sm-2"><a href="/web/qa?id=%s">%s</a></div><div class="col-sm-4">%s</div><div class="col-sm-1">%s</div>',qa.id,qa.id,qa.name,qa.type)
                out('</div>')
                if next(qa.childDevices) then
                  out("<ul>")
                  for ic,child in pairs(qa.childDevices) do
                     out('<li>%s - <a href="/web/qa?id=%s">%s</a></li>',ic,ic,child.name) 
                  end
                  out("</ul>")
                end
               end
            end
          end
        }}}
     
      <div class="row"><div class="col-sm-2"></p></div></div>
      
      <div class="row"><h4>Loaded Scenes</h4></div>
     
    </div>
    
    <div class="col-sm-4">
      <div class="row">
    
{{{
    local flags = EM.debugFlags
    local function switch(name,descr)
       out([[
         <div class="form-check form-switch"">
         <input class="form-check-input" name="%s" type="checkbox" id="%sF" %s 
            onChange="window.location.href='/TQAE/debugSwitch?name=%s'"
            aria-describedby="%sH">
         <label class="form-check-label" for="%sF">%s</label>
         <div id="%sH" class="form-text">%s</div>
         
         </div>]],name,name,flags[name]==true and "checked" or "",name,true,name,name,name,EM.LOG.descr[name] or "Undocumented")
    end
    local res = {}
    for flag,_ in pairs(EM.LOG.flags) do res[#res+1]=flag end
    table.sort(res)
    for _,flag in pairs(res) do
      switch(flag,"debug."..flag)
    end
}}}

      </div>
    </div>
    
  </div>
</div>

 {{{ html.footer(out) }}}

</body>
</html>